{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "Chapter 04\n",
    "# 代码注释\n",
    "Book_1《编程不难》 | 鸢尾花书：从加减乘除到机器学习"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 1 2 3 4 5 6 7 8 9]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "# 导入名为NumPy的第三方库，并将其重命名为np\n",
    "\n",
    "x_array = np.arange(10)  # x_array有10个元素\n",
    "# 这行代码使用NumPy库中的函数numpy.arange()\n",
    "# 创建了一个名为x_array的一维数组\n",
    "# 包含从0到9共10个整数\n",
    "\n",
    "print(x_array)  # 打印数组"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "start_time": "2024-07-02T11:06:16.656271Z",
     "end_time": "2024-07-02T11:06:16.838441Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.5\n"
     ]
    }
   ],
   "source": [
    "def my_function(x, y):\n",
    "    \"\"\"\n",
    "    这个自定义函数计算两个数值x和y的和\n",
    "    函数输入为:\n",
    "        x: The first number to be added.\n",
    "        y: The second number to be added.\n",
    "    函数输出为:\n",
    "        The sum of x and y.\n",
    "    \"\"\"\n",
    "    return x + y\n",
    "\n",
    "\n",
    "# 打印结果\n",
    "print(my_function(1.5, 2))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "start_time": "2024-07-02T11:06:26.585917Z",
     "end_time": "2024-07-02T11:06:26.629930Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
